package com.zhangxin.designmode.fiveprinciple.lod.after;

/**
 * @author zhangxin
 * @date 2022/4/16
 */
public class DocumentFactory {

    private HtmlDownloader htmlDownloader;

    public DocumentFactory(HtmlDownloader htmlDownloader) {
        this.htmlDownloader = htmlDownloader;
    }

    public Document createDocument(String url) {
        Html html = htmlDownloader.downloadHtml(url);
        return new Document(html, url);
    }
}
